﻿using Microsoft.AspNetCore.SignalR;

namespace First_WebAPI.SignalRServer
{
    public class ServiceHub : Hub
    {
        //可以多个方法共存，只要符合C#语法的语义即可。
        public Task SendMessage(string user, string message)
        {
            while (true)
            {
                Console.Out.WriteLineAsync($"服务器ServiceHub收到消息了,{user},{DateTime.Now},{message}");
                return this.Clients.All.SendAsync("ServiceHub", user, DateTime.Now.ToString());
            }
        }
        public Task DDDD( string message)
        {
            while (true)
            {
                Console.Out.WriteLineAsync($"DDDD收到消息了,{DateTime.Now},{message}");
                return this.Clients.All.SendAsync("ServiceHub", DateTime.Now.ToString());
            }
        }
    }
}
